<?php
/**
 * Created by PhpStorm.
 * User: lenove
 * Date: 2018/12/11
 * Time: 16:29
 */
header("Content-Type:application/json;charset=utf-8");

if(isset($_REQUEST["gid"])){
    $str= file_get_contents("../data/GoodsData.json");
    //1把字符串转 对象
    $listArr=json_decode($str);
    //2, 遍历对象
    foreach($listArr as $item){
        if($item->gid==$_REQUEST["gid"]){
            print_r(json_encode($item));
            return;
        }
    }
}